<template>
  <el-pagination
    @size-change="handleSizeChange"
    @current-change="handleCurrentChange"
    :current-page="currentPage4"
    :page-sizes="[20, 30, 40, 50]"
    :page-size="100"
    layout="total, sizes, prev, pager, next, jumper"
    :total="total"
  >
  </el-pagination>
</template>

<script>
// 引入axios
import { product_list } from "@/network/api/store/index";
export default {
  methods: {
    async handleSizeChange(val) {
      // 获取父组件的方法
      this.limit = val;
      let { updatetableData } = this.$parent;
      let res = await product_list(1, val, this.num);
      updatetableData(res.data.data.list);
    },
    async handleCurrentChange(val) {
      let { limit } = this.$data;
      let { updatetableData } = this.$parent;
      let res = await product_list(val, limit, this.num);
      updatetableData(res.data.data.list);
    },
  },
  data() {
    return {
      currentPage4: 1,
      limit: 20, //每页显示多少条
    };
  },
  props: {
    num: Number,
    total: Number,
  },
  created() {},
};
</script>

<style></style>
